<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro"
      xmlns="http://www.w3.org/1999/html">
<head>
    <th:block th:include="include :: header('货运订单列表')" />
    <th:block th:include="include :: bootstrap-select-css" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-10 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>提验人：</label>
                                <input type="text" name="vehicleInspector"/>
                            </li>
                            <li>
                                <label>业务员：</label>
                                <input type="text" name="userName"/>
                            </li>
                            <li>
                                <label>车型：</label>
                                <input type="text" name="vehicleModel"/>
                            </li>
                            <li>
                                <label>车架号：</label>
                                <input type="text" name="vin"/>
                            </li>
                            <li>
                                <label>托运人电话：</label>
                                <input type="text" name="clientPhone"/>
                            </li>
                            <li>
                                <label>起始地：</label>
                                <input type="text" name="origin"/>
                            </li>
                            <li>
                                <label>目的地：</label>
                                <input type="text" name="dest"/>
                            </li>
                            <li>
                                <label>接车人电话：</label>
                                <input type="text" name="receiverPhone"/>
                            </li>
                            <li class="select-time">
                                <label>操作时间： </label>
                                <input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginTime]"/>
                                <span>-</span>
                                <input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endTime]"/>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-success" onclick="$.operate.editAll()" shiro:hasPermission="system:order:edit">
                    <i class="fa fa-plus"></i> 批量发运
                </a>
                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:order:remove">
                    <i class="fa fa-remove"></i> 删除
                </a>
                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:order:export">
                    <i class="fa fa-download"></i> 导出
                </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: bootstrap-select-js" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('system:order:edit')}]];
        var removeFlag = [[${@permission.hasPermi('system:order:remove')}]];
        var prefix = ctx + "system/order";
        var datasPay = [[${@dict.getType('pay_type')}]];
        var datasType = [[${@dict.getType('order_type')}]];
        var datasDelete = [[${@dict.getType('is_delete')}]];

        $(function() {
            var options = {
                url: prefix + "/listTwo",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                editUrl : prefix + "/transport/{id}",
                modalName: "货运订单",
                pageList: [10, 25, 50],
                showFooter: true,
                striped: true,
                undefinedText: '-',
                columns: [{
                    checkbox: true
                },
                {
                    field: 'id',
                    title: '主键',

                    visible: false
                },
                {
                    field: 'createUser',
                    title: '建单人'
                },
                {
                    field: 'vehicleInspector',
                    title: '提验人'
                },
                {
                    field: 'inspectionFee',
                    title: '提验费'
                },
                {
                    field: 'agencyFee',
                    title: '中介费'
                },
                {
                    field: 'userName',
                    title: '业务员'
                },
                {
                    field: 'vehicleModel',
                    title: '车型'
                },
                {
                    field: 'vin',
                    title: '车架号'
                },
                {
                    field: 'client',
                    title: '托运人'
                },
                // {
                //     field: 'clientPhone',
                //     title: '托运人电话'
                // },
                {
                    field: 'origin',
                    title: '起始地'
                },
                {
                    field: 'dest',
                    title: '目的地'
                },
                // {
                //     field: 'receiver',
                //     title: '接收人'
                // },
                {
                    field: 'receiverPhone',
                    title: '接车人电话'
                },
                    {
                        field: 'payType',
                        title: '支付方式',
                        align: 'center',
                        formatter: function(value, row, index) {
                            return $.table.selectDictLabel(datasPay, value);
                        }
                    },
                    {
                        field: 'freightAmount',
                        title: '运费金额'
                    },
                    {
                        field: 'paidAmount',
                        title: '已付金额'
                    },
                    {
                        field: 'orderType',
                        title: '订单状态',
                        align: 'center',
                        formatter: function(value, row, index) {
                            return $.table.selectDictLabel(datasType, value);
                        }
                    },
                    // {
                    //     field: 'profit',
                    //     title: '利润'
                    // },
                    {
                        field: 'notes',
                        title: '备注'
                    },
                    {
                        field: 'createTime',
                        title: '建单时间'
                    },
                    {
                        field: 'isDelete',
                        title: '数据状态',
                        align: 'center',
                        formatter: function(value, row, index) {
                            return $.table.selectDictLabel(datasDelete, value);
                        }
                    },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.editFull(\'' + row.id + '\')"><i class="fa fa-edit"></i>发运</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });

    </script>
</body>
</html>